package ooday05;
/**枚举的演示*/
public class EnumDemo {
    public static void main(String[] args) {

        Season s = Season.valueOf("SPRING");//获取春天对象（获取一个）
        System.out.println(s.getSeasonName()+","+s.getSeasonDesc());
        switch (s){//switch...case 天生支持枚举
            case WINDER:
                System.out.println(1);
                break;
            case SPRING:
                System.out.println(2);
                break;
            case AUTUMN:
                System.out.println(3);
                break;
            case SUMMER:
                System.out.println(4);
                break;
        }

        Season [] seasons = Season.values();//获取所有枚举对象
        for (int i = 0; i < seasons.length; i++) {
            System.out.println(seasons[i]);
            System.out.println(seasons[i].getSeasonName());
            System.out.println(seasons[i].getSeasonDesc());
        }

    }
}

